﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Converter="clr-namespace:ASPItalia.ModelVirtualCasting.WPF.Converter"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    xmlns:models="http://schemas.aspitalia.com/ModelVirtualCasting/XAML/Models"
                    mc:Ignorable="d" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
    <Converter:SelectOneOrDefault x:Key="SelectOneOrDefaultConverter" />
<!--Pennelli-->  
		<DrawingBrush x:Key="Layer_1" Stretch="Uniform">
		<DrawingBrush.Drawing>
			<DrawingGroup>
				<DrawingGroup.Children>
					<GeometryDrawing Brush="#FFC0C0C0" Geometry="F1 M 401.125,27.3887C 545.264,27.3887 662.112,144.237 662.112,288.376C 662.112,432.515 545.264,549.363 401.125,549.363C 256.986,549.363 140.138,432.515 140.138,288.376C 140.138,144.237 256.986,27.3887 401.125,27.3887 Z ">
						<GeometryDrawing.Pen>
							<Pen LineJoin="Round" Brush="#FF000000"/>
						</GeometryDrawing.Pen>
					</GeometryDrawing>
					<GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 257.129,81.0536L 403.75,227.675L 545.121,86.3035L 607.697,148.879L 466.326,290.251L 603.947,427.872L 541.371,490.448L 403.75,352.826L 260.878,495.698L 198.303,433.122L 341.174,290.251L 194.553,143.629L 257.129,81.0536 Z ">
						<GeometryDrawing.Pen>
							<Pen LineJoin="Round" Brush="#FF0B0B0B"/>
						</GeometryDrawing.Pen>
					</GeometryDrawing>
				</DrawingGroup.Children>
			</DrawingGroup>
		</DrawingBrush.Drawing>
	</DrawingBrush>
 <SolidColorBrush x:Key="ListBorder"
                     Color="#828790" />
    <LinearGradientBrush x:Key="ListBoxBackgroundUp2"
                         EndPoint="0.5,1"
                         StartPoint="0.5,0">
        <GradientStop Color="#99FFFFFF"
                      Offset="0.014" />
        <GradientStop Color="Transparent"
                      Offset="1" />
        <GradientStop Color="White"
                      Offset="0" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="ListBoxBackgroundUp"
                         EndPoint="0.5,1"
                         StartPoint="0.5,0">
        <GradientStop Color="#99FFFFFF"
                      Offset="0.986" />
        <GradientStop Color="Transparent" />
        <GradientStop Color="White"
                      Offset="1" />
    </LinearGradientBrush>
    <!--Style pannelli-->
    <ItemsPanelTemplate x:Key="NewModelItemsPanelTemplate">
        <WrapPanel />
    </ItemsPanelTemplate>
    <ItemsPanelTemplate x:Key="ModelItemsPanelTemplate">
        <VirtualizingStackPanel IsItemsHost="True"
                                Orientation="Horizontal" />
    </ItemsPanelTemplate>


    <!--DataTemplate -->
    <DataTemplate  DataType="{x:Type models:MultimediaImage}">
        <Image Source="{Binding ImageSource}" />
    </DataTemplate>

    <DataTemplate  DataType="{x:Type models:MultimediaMovie}">
        <Image Source="/Style/video.png" />
    </DataTemplate>

    <DataTemplate x:Key="MainModelDataTemplate">
            <DockPanel>
            <Border Padding="5,5,5,20">
                <Border.Effect>
                    <DropShadowEffect BlurRadius="7"
                                      Opacity="0.555" />
                </Border.Effect>
                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1"
                                         StartPoint="0.5,0">
                        <GradientStop Color="#FF747474"
                                      Offset="1" />
                        <GradientStop Color="White"
                                      Offset="0.802" />
                    </LinearGradientBrush>
                </Border.Background>
                <ContentControl Content="{Binding  Multimedia[0]}"
                              /> 
            </Border>
            <TextBlock  TextWrapping="Wrap"
                        Text="{Binding FullName}"
                        VerticalAlignment="Center" />
        </DockPanel>
    </DataTemplate>
    <DataTemplate x:Key="DetailModelDataTemplate">
        <ContentControl Content="{Binding }" />
    </DataTemplate>
    <!--Style contenitori-->
    <Style x:Key="CandidateItemContainerStyle"
           TargetType="{x:Type ListBoxItem}">
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="HorizontalContentAlignment"
                Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="VerticalContentAlignment"
                Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="Padding"
                Value="2,0,0,0" />
        <Setter Property="MaxWidth"
                Value="290" />
        <Setter Property="MinWidth"
                Value="150" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Border x:Name="Bd"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            Padding="{TemplateBinding Padding}"
                            SnapsToDevicePixels="true">
                        <Grid Height="Auto">
                    		<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                    			SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                    			VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    		<Canvas x:Name="CanBeNakedContainer"  Visibility="Collapsed" HorizontalAlignment="Right" Height="16" VerticalAlignment="Top" Width="16">
                    			<Ellipse Height="16" Width="16" >
                    				<Ellipse.Fill>
                    					<RadialGradientBrush GradientOrigin="0.88,0.809" RadiusY="0.707" RadiusX="0.707">
                    						<GradientStop Color="White" Offset="0.059"/>
                    						<GradientStop Color="#FFFF1414" Offset="0.668"/>
                    						<GradientStop Color="#FF0E0000" Offset="1"/>
                    					</RadialGradientBrush>
                    				</Ellipse.Fill>
                    			</Ellipse>
                    			<Ellipse Height="3.625" Canvas.Left="6.125" Canvas.Top="1.162" Width="3.625" Fill="White"/>
                    			<Rectangle Fill="White" Height="5.063" Canvas.Left="6.125" Canvas.Top="5.081" Width="3.625" StrokeThickness="0" RadiusX="1.083" RadiusY="1.083"/>
                    			<Rectangle Fill="White" Height="4.75" Canvas.Left="6.281" RadiusY="0.583" RadiusX="0.583" StrokeThickness="0" Canvas.Top="10.144" Width="1.708"/>
                    			<Rectangle Fill="White" Height="4.75" Canvas.Left="8.052" RadiusY="0.583" RadiusX="0.583" StrokeThickness="0" Canvas.Top="10.144" Width="1.667"/>
                    			<Rectangle Fill="White" Height="4.75" Canvas.Left="5" RadiusY="0.583" RadiusX="0.583" StrokeThickness="0" Canvas.Top="4.925" Width="1.875" RenderTransformOrigin="0.5,0.5">
                    				<Rectangle.RenderTransform>
                    					<TransformGroup>
                    						<ScaleTransform/>
                    						<SkewTransform/>
                    						<RotateTransform Angle="41.249"/>
                    						<TranslateTransform/>
                    					</TransformGroup>
                    				</Rectangle.RenderTransform>
                    			</Rectangle>
                    			<Rectangle Fill="White" Height="4.75" Canvas.Left="8.938" RadiusY="0.583" RadiusX="0.583" StrokeThickness="0" Canvas.Top="4.956" Width="1.875" RenderTransformOrigin="0.5,0.5">
                    				<Rectangle.RenderTransform>
                    					<TransformGroup>
                    						<ScaleTransform/>
                    						<SkewTransform/>
                    						<RotateTransform Angle="-40.905"/>
                    						<TranslateTransform/>
                    					</TransformGroup>
                    				</Rectangle.RenderTransform>
                    			</Rectangle>
                    		</Canvas>
                    	</Grid>
                    </Border>
                    <ControlTemplate.Triggers>
						<DataTrigger Binding="{Binding CanBeNaked}" Value="True">
							<Setter TargetName="CanBeNakedContainer" Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                        <Trigger Property="IsSelected"
                                 Value="true">
                            <Setter Property="Background"
                                    TargetName="Bd"
                                    Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected"
                                           Value="true" />
                                <Condition Property="Selector.IsSelectionActive"
                                           Value="false" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Background"
                                    TargetName="Bd"
                                    Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
                        </MultiTrigger>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="NewCandidateItemContainerStyle"
           TargetType="{x:Type ListBoxItem}"
           BasedOn="{StaticResource CandidateItemContainerStyle}">
        <Setter Property="Margin"
                Value="5" />
        <Setter Property="Width"
                Value="200" />
        <Setter Property="Height"
                Value="100" />
    </Style>
    <Style x:Key="DetailsItemContainerStyle"
           TargetType="{x:Type ListBoxItem}">
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="HorizontalContentAlignment"
                Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="VerticalContentAlignment"
                Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="Padding"
                Value="2,0,0,0" />
        <Setter Property="MaxWidth"
                Value="50" />

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Border x:Name="Bd"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            Padding="{TemplateBinding Padding}"
                            SnapsToDevicePixels="true">
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                    		SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                    		VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Border>
                    <ControlTemplate.Triggers>
                   
                        <Trigger Property="IsSelected"
                                 Value="true">
                            <Setter Property="Background"
                                    TargetName="Bd"
                                    Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected"
                                           Value="true" />
                                <Condition Property="Selector.IsSelectionActive"
                                           Value="false" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Background"
                                    TargetName="Bd"
                                    Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
                        </MultiTrigger>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--Style aspetto ListBox-->
    <Style x:Key="CandidateListBoxStyle"
           TargetType="{x:Type ListBox}">
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1"
                                     StartPoint="0.5,0">
                    <GradientStop Color="#99FFFFFF"
                                  Offset="0.014" />
                    <GradientStop Color="Transparent"
                                  Offset="1" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderBrush"
                Value="{x:Null}" />
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility"
                Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility"
                Value="Disabled" />
        <Setter Property="ScrollViewer.CanContentScroll"
                Value="true" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <Border x:Name="Bd"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            Padding="1"
                            SnapsToDevicePixels="true">
                    	<ScrollViewer Height="Auto" Style="{DynamicResource SimpleScrollViewer}" Width="Auto">
                    		<ItemsPresenter Height="Auto"/>
                    	</ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Background"
                                    TargetName="Bd"
                                    Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
                        </Trigger>
                        <Trigger Property="IsGrouping"
                                 Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll"
                                    Value="false" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderThickness"
                Value="0" />
        <Setter Property="ItemTemplate"
                Value="{StaticResource MainModelDataTemplate}" />
        <Setter Property="ItemsPanel"
                Value="{DynamicResource ModelItemsPanelTemplate}" />
        <Setter Property="ItemContainerStyle"
                Value="{DynamicResource CandidateItemContainerStyle}" />
        <Setter Property="Background"
                Value="{DynamicResource ListBoxBackgroundUp2}" />
    </Style>
    <Style x:Key="SelectedCandidateListBoxStyle" BasedOn="{StaticResource CandidateListBoxStyle}"
           TargetType="{x:Type ListBox}">
        <Setter Property="Background"
                Value="{DynamicResource ListBoxBackgroundUp}" />
    </Style>
    <Style x:Key="DetailsCandidateListBoxStyle"
           BasedOn="{StaticResource CandidateListBoxStyle}"
           TargetType="{x:Type ListBox}">
        <Setter Property="Background"
                Value="Transparent" />
       <Setter Property="ItemTemplate"
                Value="{StaticResource DetailModelDataTemplate}" />
        <Setter Property="ItemsPanel"
                Value="{DynamicResource ModelItemsPanelTemplate}" />
        <Setter Property="ItemContainerStyle"
                Value="{DynamicResource DetailsItemContainerStyle}" />
    </Style>
    <Style x:Key="NewModelListBoxStyle"
           TargetType="{x:Type ListBox}"
           BasedOn="{StaticResource CandidateListBoxStyle}">
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility"
                Value="Disabled" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility"
                Value="Auto" />
        <Setter Property="ItemsPanel"
                Value="{StaticResource NewModelItemsPanelTemplate}" />
        <Setter Property="Background"
                Value="#80FFFFFF" />
        <Setter Property="ItemContainerStyle"
                Value="{StaticResource NewCandidateItemContainerStyle}" />
    </Style>

   
	<ControlTemplate x:Key="ModelScrollViewerControlTemplate" TargetType="{x:Type ScrollViewer}">
		<Grid x:Name="Grid" Background="{TemplateBinding Background}">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition Width="Auto"/>
			</Grid.ColumnDefinitions>
			<Grid.RowDefinitions>
				<RowDefinition Height="*"/>
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
			<Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/>
			<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
			<ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Style="{DynamicResource ModelScrollBarStyle}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
			<ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="0"  Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" Style="{DynamicResource HorizontalScrollBarStyle}" Background="{x:Null}"/>
		</Grid>
	</ControlTemplate>
	<LinearGradientBrush x:Key="VerticalScrollBarBackground" EndPoint="1,0" StartPoint="0,0">
		<GradientStop Color="#E1E1E1" Offset="0"/>
		<GradientStop Color="#EDEDED" Offset="0.20"/>
		<GradientStop Color="#EDEDED" Offset="0.80"/>
		<GradientStop Color="#E3E3E3" Offset="1"/>
	</LinearGradientBrush>
	<SolidColorBrush x:Key="ScrollBarDisabledBackground" Color="#F4F4F4"/>
	<Style x:Key="ScrollBarButton" TargetType="{x:Type RepeatButton}">
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="Focusable" Value="false"/>
		<Setter Property="IsTabStop" Value="false"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RepeatButton}">
					<Border BorderThickness="1" Background="#FF494949"/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style x:Key="VerticalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="Background" Value="Transparent"/>
		<Setter Property="Focusable" Value="false"/>
		<Setter Property="IsTabStop" Value="false"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RepeatButton}">
					<Rectangle Fill="{TemplateBinding Background}" />
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="IsTabStop" Value="false"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Thumb}">
				<Border CornerRadius="2" Background="#FF4B4B4B"></Border>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<LinearGradientBrush x:Key="HorizontalScrollBarBackground" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#E1E1E1" Offset="0"/>
		<GradientStop Color="#EDEDED" Offset="0.20"/>
		<GradientStop Color="#EDEDED" Offset="0.80"/>
		<GradientStop Color="#E3E3E3" Offset="1"/>
	</LinearGradientBrush>
	<Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}">
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="Background" Value="Transparent"/>
		<Setter Property="Focusable" Value="false"/>
		<Setter Property="IsTabStop" Value="false"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RepeatButton}">
					<Rectangle Fill="{TemplateBinding Background}"/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style x:Key="ModelScrollBarStyle" TargetType="{x:Type ScrollBar}">
		<Setter Property="Background" Value="{x:Null}"/>
		<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
		<Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
		<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
		
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ScrollBar}">
					<Grid x:Name="Bg" Background="{TemplateBinding Background}" SnapsToDevicePixels="true" Width="5">
						<Grid.RowDefinitions>
							<RowDefinition />
							<RowDefinition Height="0.00001*"/>
							<RowDefinition />
						</Grid.RowDefinitions>
						<RepeatButton Command="{x:Static ScrollBar.LineUpCommand}" IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBarButton}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="UpArrow" Visibility="Hidden"/>
						<Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}" Grid.Row="1">
							<Track.DecreaseRepeatButton>
								<RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButton}" Visibility="Hidden"/>
							</Track.DecreaseRepeatButton>
							<Track.IncreaseRepeatButton>
								<RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButton}" Visibility="Hidden"/>
							</Track.IncreaseRepeatButton>
							<Track.Thumb>
								<Thumb Style="{StaticResource ScrollBarThumb}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="VerticalGripper"/>
							</Track.Thumb>
						</Track>
						<RepeatButton Command="{x:Static ScrollBar.LineDownCommand}" IsEnabled="{TemplateBinding IsMouseOver}" Grid.Row="2" Style="{StaticResource ScrollBarButton}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="DownArrow" Visibility="Hidden"/>
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="IsEnabled" Value="false">
							<Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="Width" Value="5"/>
		<Style.Triggers>
			<Trigger Property="Orientation" Value="Horizontal">
				<Setter Property="Width" Value="Auto"/>
				<Setter Property="MinWidth" Value="0"/>
			
				<Setter Property="Background" Value="{StaticResource HorizontalScrollBarBackground}"/>
				<Setter Property="Template">
					<Setter.Value>
						<ControlTemplate TargetType="{x:Type ScrollBar}">
							<Grid x:Name="Bg" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
								<Grid.ColumnDefinitions>
									<ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
									<ColumnDefinition Width="0.00001*"/>
									<ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
								</Grid.ColumnDefinitions>
								<RepeatButton Command="{x:Static ScrollBar.LineLeftCommand}" IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBarButton}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="LeftArrow"/>
								<Track x:Name="PART_Track" Grid.Column="1" IsEnabled="{TemplateBinding IsMouseOver}">
									<Track.DecreaseRepeatButton>
										<RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
									</Track.DecreaseRepeatButton>
									<Track.IncreaseRepeatButton>
										<RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
									</Track.IncreaseRepeatButton>
									<Track.Thumb>
										<Thumb Style="{StaticResource ScrollBarThumb}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="HorizontalGripper"/>
									</Track.Thumb>
								</Track>
								<RepeatButton Grid.Column="2" Command="{x:Static ScrollBar.LineRightCommand}" IsEnabled="{TemplateBinding IsMouseOver}" Style="{StaticResource ScrollBarButton}" Microsoft_Windows_Themes:ScrollChrome.ScrollGlyph="RightArrow"/>
							</Grid>
							<ControlTemplate.Triggers>
								<Trigger Property="IsEnabled" Value="false">
									<Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
								</Trigger>
							</ControlTemplate.Triggers>
						</ControlTemplate>
					</Setter.Value>
				</Setter>
			</Trigger>
		</Style.Triggers>
	</Style>
	<Style x:Key="ButtonFocusVisual">
		<Setter Property="Control.Template">
			<Setter.Value>
				<ControlTemplate>
					<Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="Black" StrokeThickness="1" StrokeDashArray="1 2"/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#F3F3F3" Offset="0"/>
		<GradientStop Color="#EBEBEB" Offset="0.5"/>
		<GradientStop Color="#DDDDDD" Offset="0.5"/>
		<GradientStop Color="#CDCDCD" Offset="1"/>
	</LinearGradientBrush>
	<SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070"/>
	<Style x:Key="CloseButton" TargetType="{x:Type Button}">
		<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
		<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
		<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
		<Setter Property="BorderThickness" Value="1"/>
		<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
		<Setter Property="HorizontalContentAlignment" Value="Center"/>
		<Setter Property="VerticalContentAlignment" Value="Center"/>
		<Setter Property="Padding" Value="1"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Button}">
					<Grid x:Name="grid" Background="Transparent">
							<Ellipse x:Name="CloseBackground"  Canvas.Top="26.8887" Stretch="Fill" StrokeLineJoin="Round"  Fill="#FFC0C0C0"/>
		<Path x:Name="path"  Canvas.Left="194.053" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF0B0B0B" Fill="#FFFFFFFF" Data="F1 M 257.129,81.0536L 403.75,227.675L 545.121,86.3035L 607.697,148.879L 466.326,290.251L 603.947,427.872L 541.371,490.448L 403.75,352.826L 260.878,495.698L 198.303,433.122L 341.174,290.251L 194.553,143.629L 257.129,81.0536 Z " RenderTransformOrigin="0.5,0.5">
			<Path.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="0.7" ScaleY="0.7"/>
					<SkewTransform/>
					<RotateTransform/>
					<TranslateTransform/>
				</TransformGroup>
			</Path.RenderTransform>
		</Path>

						<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="IsKeyboardFocused" Value="true"/>
						<Trigger Property="ToggleButton.IsChecked" Value="true"/>
						<Trigger Property="IsEnabled" Value="false">
							<Setter Property="Foreground" Value="#ADADAD"/>
						</Trigger>
						<Trigger Property="IsMouseOver" Value="True" SourceName="grid">
							<Setter Property="Fill" TargetName="path" Value="#FFB10A0A"/>
							<Setter Property="Fill" TargetName="CloseBackground" Value="#00C0C0C0"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="Margin" Value="0,10,20,0"/>
	</Style>
	<Style x:Key="VerticalScrollBarStyle" TargetType="{x:Type ScrollBar}">
		<Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
		<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ScrollBar}">
					<Grid x:Name="GridRoot"  Background="{TemplateBinding Background}" >
						<Grid.RowDefinitions>
							<RowDefinition MaxHeight="18"/>
							<RowDefinition Height="0.00001*"/>
							<RowDefinition MaxHeight="18"/>
						</Grid.RowDefinitions>
						
						<RepeatButton x:Name="DecreaseRepeat" Style="{DynamicResource SimpleRepeatButton}" Command="ScrollBar.LineUpCommand" Visibility="Visible">
							<RepeatButton.BorderBrush>
								<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
									<GradientStop Color="#00CCCCCC" Offset="1"/>
									<GradientStop Color="#FF444444" Offset="0.3"/>
								</LinearGradientBrush>
							</RepeatButton.BorderBrush>
							<RepeatButton.Background>
								<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
									<GradientStop Color="#FFEEEEEE" Offset="0.3"/>
									<GradientStop Color="#00CCCCCC" Offset="1"/>
								</LinearGradientBrush>
							</RepeatButton.Background>
							<Grid>
								<Path x:Name="DecreaseArrow" StrokeThickness="1" Data="M 0 4 L 8 4 L 4 0 Z" Fill="#FF333333"/>
							</Grid>
						</RepeatButton>
						
						<!-- Track is a special layout container which sizes the thumb and the repeat button which do jump scrolling either side of it -->
						<Track Grid.Row="1" x:Name="PART_Track" Orientation="Vertical" IsDirectionReversed="true">
							<Track.Thumb>
								<Thumb Style="{DynamicResource SimpleThumbStyle}" Visibility="Hidden"/>
							</Track.Thumb>
							<Track.IncreaseRepeatButton>
								<RepeatButton x:Name="PageUp" Style="{DynamicResource SimpleScrollRepeatButtonStyle}" Command="ScrollBar.PageDownCommand" Visibility="Hidden"/>
							</Track.IncreaseRepeatButton>
							<Track.DecreaseRepeatButton>
								<RepeatButton x:Name="PageDown" Style="{DynamicResource SimpleScrollRepeatButtonStyle}" Command="ScrollBar.PageUpCommand" Visibility="Hidden"/>
							</Track.DecreaseRepeatButton>
						</Track>
						
						<RepeatButton Grid.Row="2" x:Name="IncreaseRepeat" Style="{DynamicResource SimpleRepeatButton}" Command="ScrollBar.LineDownCommand" Visibility="Visible">
							<RepeatButton.BorderBrush>
								<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
									<GradientStop Color="#00CCCCCC"/>
									<GradientStop Color="#FF444444" Offset="1"/>
								</LinearGradientBrush>
							</RepeatButton.BorderBrush>
							<RepeatButton.Background>
								<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
									<GradientStop Color="#00EEEEEE"/>
									<GradientStop Color="#FFCCCCCC" Offset="1"/>
								</LinearGradientBrush>
							</RepeatButton.Background>
							<Grid>
								<Path x:Name="IncreaseArrow" StrokeThickness="1" Data="M 0 0 L 4 4 L 8 0 Z" Fill="#FF333333"/>
							</Grid>
						</RepeatButton>
					</Grid>
					
					<!-- This uses a single template for ScrollBar and rotate it to be Horizontal
					It also changes the commands so that the it does Left and Right instead of Up and Down Commands -->
					<ControlTemplate.Triggers>
						<Trigger Property="Orientation" Value="Horizontal">

							<!-- Rotate the ScrollBar from Vertical to Horizontal -->
							<Setter Property="LayoutTransform" TargetName="GridRoot">
								<Setter.Value>
									<RotateTransform Angle="-90"/>
								</Setter.Value>
							</Setter>
							
							<!-- Track is bound to Orientation internally, so we need to rotate it back to Vertical -->
							<Setter TargetName="PART_Track" Property="Orientation" Value="Vertical"/>
					
							<!-- Change the commands to do Horizontal commands -->
							<Setter Property="Command" Value="ScrollBar.LineLeftCommand" TargetName="DecreaseRepeat"/>
							<Setter Property="Command" Value="ScrollBar.LineRightCommand" TargetName="IncreaseRepeat"/>
							<Setter Property="Command" Value="ScrollBar.PageLeftCommand" TargetName="PageDown"/>
							<Setter Property="Command" Value="ScrollBar.PageRightCommand" TargetName="PageUp"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="Background" Value="{x:Null}"/>
	</Style>
	<LinearGradientBrush x:Key="TextBoxBorder" EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0">
		<GradientStop Color="#ABADB3" Offset="0.05"/>
		<GradientStop Color="#E2E3EA" Offset="0.07"/>
		<GradientStop Color="#E3E9EF" Offset="1"/>
	</LinearGradientBrush>
	<Style x:Key="DetailTextBlockStyle" TargetType="{x:Type TextBlock}">
		<Setter Property="TextWrapping" Value="NoWrap"/>
		<Setter Property="TextTrimming" Value="None"/>
		<Setter Property="Margin" Value="2"/>
	</Style>
	<Style x:Key="RecordButtonStyle" TargetType="{x:Type Button}">
		<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
		<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
		<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
		<Setter Property="BorderThickness" Value="1"/>
		<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
		<Setter Property="HorizontalContentAlignment" Value="Center"/>
		<Setter Property="VerticalContentAlignment" Value="Center"/>
		<Setter Property="Padding" Value="1"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Button}">
					<Grid HorizontalAlignment="Center" VerticalAlignment="Center" >
						<Grid.RowDefinitions>
							<RowDefinition Height="30*"/>
							<RowDefinition Height="auto"/>
						</Grid.RowDefinitions>
						<Grid.ColumnDefinitions>
							<ColumnDefinition />
						</Grid.ColumnDefinitions>
						<ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="1" d:LayoutOverrides="Width, Height">
							<ContentPresenter.Effect>
								<DropShadowEffect ShadowDepth="1" BlurRadius="2"/>
							</ContentPresenter.Effect>
						</ContentPresenter>
						<Ellipse Stroke="Black" Grid.RowSpan="1" Width="15" Height="15">
							<Ellipse.Fill>
								<RadialGradientBrush>
									<GradientStop Color="Black" Offset="1"/>
									<GradientStop Color="#FFD23535" Offset="0.655"/>
									<GradientStop Color="#FFFF2424"/>
								</RadialGradientBrush>
							</Ellipse.Fill>
						</Ellipse>
					</Grid>
					<ControlTemplate.Triggers>
						<Trigger Property="IsKeyboardFocused" Value="true"/>
						<Trigger Property="ToggleButton.IsChecked" Value="true"/>
						<Trigger Property="IsEnabled" Value="false">
							<Setter Property="Foreground" Value="#ADADAD"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>


   
</ResourceDictionary>